<?php 
require_once('../mysqlUtil.php');
require_once('../islogin.php');
//获取请求参数

$imagePath=$_POST['imagePath'];
$shopName=$_POST['shopName'];
$shopNum=$_POST['shopNum'];
$shopPrice=$_POST['shopPrice'];
$ShopState=$_POST['ShopState'];
$islimit=$_POST['islimit'];
$limitNumber=$_POST['limitNumber'];
//预处理及绑定
$sql = "INSERT INTO `t_goods` 
( `name`, `num`, `price`, `state`, `islimit`, `limitNumber`, `imagePath`) 
VALUES ( ?, ?, ?, ?, ?, ?, ?);";
$stmt=$conn->prepare($sql);
//设置参数并执行
$stmt->bind_param("sidiiis",$shopName,$shopNum,$shopPrice,$ShopState,$islimit,$limitNumber,$imagePath);

$issuccess=$stmt->execute();
if($issuccess){
    echo json_encode(array('state' => true, 'msg' => '添加成功'));   
}else{
    echo json_encode(array('state' => true, 'msg' => 'error'));   
}

 
$conn->close();
?>